package com.wang.模式.创建.单例;

/**
 * @author wang
 * @Description
 * @create 2021-10-12 16:46
 */
public class SingletonTest03 {
    public static void main(String[] args) {
        Singleton3 instance = Singleton3.getInstance();
        Singleton3 instance1 = Singleton3.getInstance();
        System.out.println(instance);
        System.out.println(instance1);
    }
}
class Singleton3{
    private Singleton3() {
    }

    private static Singleton3 instance;

    public static Singleton3 getInstance(){
        if(instance == null){
            instance = new Singleton3();
        }
        return instance;
    }
}
